package com.tencent.wxcloudrun.repository;

import com.tencent.wxcloudrun.model.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;

@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {

    // 查询已发布的商品
    List<Product> findByPublishedTrue();

    // 根据名称模糊查询
    List<Product> findByNameContaining(String keyword);

    Optional<Product> findByPublishedTrueAndLimitAmount(Integer limitAmount);
}
